<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}{% endblock %} - 测控总体方案自动生成系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/all.min.css') }}">
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
        }

        body {
            background-color: #f8f9fa;
        }

        .navbar {
            background-color: var(--primary-color) !important;
            box-shadow: 0 2px 4px rgba(0,0,0,.1);
            padding: 1rem 0;
        }

        .navbar-brand {
            color: #fff !important;
            font-weight: 500;
            font-size: 1.25rem;
        }

        .navbar-nav .nav-link {
            color: rgba(255,255,255,0.9) !important;
            padding: 0.5rem 1rem;
            transition: all 0.3s ease;
        }

        .navbar-nav .nav-link:hover {
            color: #fff !important;
            background-color: rgba(255,255,255,0.1);
            border-radius: 4px;
        }

        .card {
            border: none;
            box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075);
            border-radius: 8px;
            transition: transform 0.3s ease;
        }

        .card:hover {
            transform: translateY(-2px);
        }

        .card-header {
            background-color: var(--primary-color);
            color: white;
            border-radius: 8px 8px 0 0 !important;
        }

        .btn-primary {
            background-color: var(--secondary-color);
            border-color: var(--secondary-color);
        }

        .btn-primary:hover {
            background-color: #2980b9;
            border-color: #2980b9;
        }

        .alert {
            border-radius: 8px;
            border: none;
        }

        /* 暗色模式支持 */
        @media (prefers-color-scheme: dark) {
            body {
                background-color: #1a1a1a;
                color: #f0f0f0;
            }

            .card {
                background-color: #2d2d2d;
                color: #f0f0f0;
            }

            .form-control {
                background-color: #333;
                border-color: #444;
                color: #f0f0f0;
            }

            .form-control:focus {
                background-color: #404040;
                color: #f0f0f0;
            }

            /* 添加表格暗色模式样式 */
            .table {
                color: #f0f0f0;
            }

            .table thead th {
                background-color: #2c3e50;
                color: #fff;
                border-color: #444;
            }

            .table tbody tr {
                border-color: #444;
            }

            .table tbody tr:hover {
                background-color: #3d3d3d;
                color: #fff;
            }

            .table td {
                border-color: #444;
            }

            /* 按钮在暗色模式下的样式 */
            .btn-outline-primary {
                color: #3498db;
                border-color: #3498db;
            }

            .btn-outline-primary:hover {
                background-color: #3498db;
                color: #fff;
            }

            .btn-outline-secondary {
                color: #95a5a6;
                border-color: #95a5a6;
            }

            .btn-outline-secondary:hover {
                background-color: #95a5a6;
                color: #fff;
            }
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('main.index') }}">
                <i class="fas fa-microchip me-2"></i>测控总体方案自动生成系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    {% if current_user.is_authenticated %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.index') }}">
                            <i class="fas fa-home me-1"></i>首页
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="projectDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-project-diagram me-1"></i>项目管理
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.create_project') }}">
                                    <i class="fas fa-plus-circle me-2"></i>新建项目
                                </a>
                            </li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.projects') }}?project_type=industrial">
                                    <i class="fas fa-industry me-2"></i>工业测控项目
                                </a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.projects') }}?project_type=environmental">
                                    <i class="fas fa-leaf me-2"></i>环境监测项目
                                </a>
                            </li>
                        </ul>
                    </li>
                    {% if current_user.role in ['engineer', 'manager'] %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.architecture_list') }}">
                            <i class="fas fa-sitemap me-1"></i>系统架构
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="equipmentDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-microchip me-1"></i>设备管理
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.equipment_list') }}">
                                    <i class="fas fa-list me-2"></i>设备列表
                                </a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.add_equipment') }}">
                                    <i class="fas fa-plus-circle me-2"></i>添加设备
                                </a>
                            </li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.equipment_list') }}?type=sensor">
                                    <i class="fas fa-wave-square me-2"></i>传感器
                                </a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.equipment_list') }}?type=controller">
                                    <i class="fas fa-microchip me-2"></i>控制器
                                </a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('main.equipment_list') }}?type=actuator">
                                    <i class="fas fa-cog me-2"></i>执行器
                                </a>
                            </li>
                        </ul>
                    </li>
                    {% endif %}
                    {% if current_user.role == 'manager' %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.users') }}">
                            <i class="fas fa-users me-1"></i>用户管理
                        </a>
                    </li>
                    {% endif %}
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-user me-1"></i>{{ current_user.username }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="{{ url_for('main.profile') }}">
                                <i class="fas fa-id-card me-2"></i>个人信息
                            </a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="{{ url_for('auth.logout') }}">
                                <i class="fas fa-sign-out-alt me-2"></i>退出
                            </a></li>
                        </ul>
                    </li>
                    {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('auth.login') }}">
                            <i class="fas fa-sign-in-alt me-1"></i>登录
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('auth.register') }}">
                            <i class="fas fa-user-plus me-1"></i>注册
                        </a>
                    </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <main class="container mt-4">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }} alert-dismissible fade show">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </main>

    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html> 